import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'
import Main from '../views/Main'
import Category from "@/views/modules/blog/category/Category";
import Tag from '@/views/modules/blog/tag/Tag'
import BlogList from "@/views/modules/blog/blog/BlogList";
import WriteBlog from "@/views/modules/blog/blog/WriteBlog";
import Comment from "@/views/modules/blog/comment/Comment";
//import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
import WriteMoment from "@/views/modules/blog/moment/WriteMoment";
import MomentList from "@/views/modules/blog/moment/MomentList";
import Friend from "@/views/modules/blog/friend/Friend";

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
        path: '/logout',
        name: 'Logout',
        component: Login
    },
    {
        path: '/main',
        name: '/Main',
        component: Main,
        children: [
            {
                path: '/category',
                name: '/Category',
                component: Category
            },
            {
                path: '/tag',
                name: '/Tag',
                component:Tag
            },
            {
                path: '/write_blog/edit/:id',
                name: '/WriteBlog',
                component: WriteBlog,
                meta:{
                    title: '编辑文章'
                }
            },
            {
                path: '/write_blog',
                name: '/WriteBlog',
                component: WriteBlog,
                meta:{
                    title: '写文章'
                }
            },
            {
                path: '/blog_list',
                name: '/BlogList',
                component: BlogList,
            },
            {
                path: '/write_moment',
                name: '/WriteMoment',
                component: WriteMoment,
                meta:{
                    title: '写动态'
                }
            },
            {
                path: '/moment_list',
                name: '/MomentList',
                component: MomentList,
            },
            {
                path: '/write_moment/edit/:id',
                name: '/WriteMoment',
                component: WriteMoment,
                meta:{
                    title: '编辑动态'
                }
            },
            {
                path: '/friend_list',
                name: '/FriendList',
                component: Friend,
            },

            {
                path: '/comment',
                name: '/Comment',
                component: Comment,
            },
        ]
    },

]

const router = new VueRouter({
    routes
})

// router.beforeEach((to, from, next) => {
//     NProgress.start()
//     next()
// })

// // eslint-disable-next-line no-unused-vars
// router.afterEach((to, from) => {
//     NProgress.done()
// })


export default router

